extern struct mutex xenwatch_mutex;
-#define streq(a, b) (strcmp((a), (b)) == 0)
-
static struct notifier_block *xenstore_chain;
/* If something in array of ids matches this device, return it. */
static const struct xenbus_device_id *
match_device(const struct xenbus_device_id *arr, struct xenbus_device *dev)
{
- for (; !streq(arr->devicetype, ""); arr++) {
- if (streq(arr->devicetype, dev->devicetype))
+ for (; *arr->devicetype != '\0'; arr++) {
+ if (!strcmp(arr->devicetype, dev->devicetype))
return arr;
}
return NULL;
}
+static void free_otherend_details(struct xenbus_device *dev)
+{
+ kfree(dev->otherend);
+ dev->otherend = NULL;
+}
+
+
+static void free_otherend_watch(struct xenbus_device *dev)
+{
+ if (dev->otherend_watch.node) {
+ unregister_xenbus_watch(&dev->otherend_watch);
+ kfree(dev->otherend_watch.node);
+ dev->otherend_watch.node = NULL;
+ }
+}
+
+
static int read_otherend_details(struct xenbus_device *xendev,
char *id_node, char *path_node)
{
!xenbus_exists(XBT_NULL, xendev->otherend, "")) {
xenbus_dev_fatal(xendev, -ENOENT, "missing other end from %s",
xendev->nodename);
- kfree(xendev->otherend);
- xendev->otherend = NULL;
+ free_otherend_details(xendev);
return -ENOENT;
}
}
-static void free_otherend_details(struct xenbus_device *dev)
-{
- kfree(dev->otherend);
- dev->otherend = NULL;
-}
-
-
-static void free_otherend_watch(struct xenbus_device *dev)
-{
- if (dev->otherend_watch.node) {
- unregister_xenbus_watch(&dev->otherend_watch);
- kfree(dev->otherend_watch.node);
- dev->otherend_watch.node = NULL;
- }
-}
-
-
/* Bus type for frontend drivers. */
static int xenbus_probe_frontend(const char *type, const char *name);
static struct xen_bus_type xenbus_frontend = {
struct xenbus_device *xendev = to_xenbus_device(dev);
struct xb_find_info *info = data;
- if (streq(xendev->nodename, info->nodename)) {
+ if (!strcmp(xendev->nodename, info->nodename)) {
info->dev = xendev;
get_device(dev);
return 1;
} while (info.dev);
}
-static void xenbus_dev_free(struct xenbus_device *xendev)
-{
- kfree(xendev);
-}
-
static void xenbus_dev_release(struct device *dev)
{
if (dev)
- xenbus_dev_free(to_xenbus_device(dev));
+ kfree(to_xenbus_device(dev));
}
/* Simplified asprintf. */
return 0;
fail:
- xenbus_dev_free(xendev);
+ kfree(xendev);
return err;
}
if (!page)
return -ENOMEM;
- /* We don't refcnt properly, so set reserved on page.
- * (this allocation is permanent) */
- SetPageReserved(virt_to_page(page));
-
xen_start_info->store_mfn =
pfn_to_mfn(virt_to_phys((void *)page) >>
PAGE_SHIFT);